package be.ac.ua.comp.projectGPT.Jobs.implementations;

import be.ac.ua.comp.projectGPT.Jobs.RunnableJob;

/**
 * Will execute a loop a certain amount of times.
 */
public class BusyLoopJob extends RunnableJob {

    int counter = 0;

    public BusyLoopJob(Integer counter) throws IllegalArgumentException {
        if(counter<0) {
            throw new IllegalArgumentException();
        }
        this.counter = counter;
    }

    public void run() {
        logger.info("Starting");
        for(int i=0;i<counter;i++) {}
        logger.info("Ending");
        setChanged();
        notifyObservers("Success");
    }
}
